#ifndef INTEGERSETHASHINTERSECTIONTESTER_H_JM_20130228
#define INTEGERSETHASHINTERSECTIONTESTER_H_JM_20130228

#include "../boxes/TesterSharedOutputBoxImpl.h"
#include "../../models/TwoStepOnePassDbOperationModel.h"

namespace jm4bbx {
	template<int parallelismLevel>
	class IntegerSetHashIntersectionTester : 
		public TesterSharedOutputBoxImplSql, public ModelTest {
	public:
		virtual std::string getTestName() const override {
			return std::string("IntegerSetHashIntersectionTester[") + 
				jmlib::convert<std::string>(parallelismLevel) + "]";
		}

		virtual std::string getDataSpecification() const override { 
			return "SELECT c1 FROM data_2 INTERSECT SELECT c1 FROM data_3"; 
		};

		virtual size_t getSharedOutputCount() const override {
			return parallelismLevel;
		}

		virtual std::string getModel() override {
			// Zaregistrovanie boxu do runtimu.
			static std::string outputBoxName = 
				std::string("IntegerSetHashIntersectionTesterOUT_") 
				+ jmlib::convert<std::string>(parallelismLevel);
			typedef IntegerSetHashIntersectionTester<parallelismLevel> ImplType;
			registerBox<ImplType>(outputBoxName.c_str());
			// Konfiguracia generatoru modelu.

			InputBoxConfiguration first = {"SELECT@c1@FROM@data_2", 0};
			InputBoxConfiguration second = {"SELECT@c1@FROM@data_3", 0};

			TwoStepOnePassDbOperationModel amg(getSharedOutputCount(), 
				"SQL_BOX", first, second, "HASH_INTEGER", "HASH_INTERSECTION_INTEGER",
				outputBoxName.c_str(), "first", "IntegerKeyRecord", false);

			return amg.generateModel();
		}
	};

} // namespace jm4bbx



#endif
